#!/bin/sh /etc/rc.common

USE_PROCD=1
START=25

start_service() {
	local nofile=$(cat /proc/sys/fs/nr_open)
	local wanmode=$(uci get docker.@docker[0].wan_mode)

	if [ $wanmode = "1" ] ;then
		dockerwan=" "
	else
		dockerwan="--iptables=false"
	fi

	procd_open_instance
	procd_set_param stderr 1
	procd_set_param command /usr/bin/dockerd $dockerwan
	procd_set_param limits nofile="${nofile} ${nofile}"
	procd_close_instance
}
